<?php
//后台公共函数
if (!defined('IN_ECS'))
{
    die('Hacking attempt');
}
//获取商家分类列表
function get_shop_cat()
{
    return $GLOBALS['db']->getAll('SELECT * FROM '.$GLOBALS['ecs']->table('shop_type').' WHERE 1');
}
//判断商家分类是否存在 
function shop_cat_exist($cat_name)
{
	if (!$cat_name) {
		return true;
	}
	$exist = $GLOBALS['db']->getOne('SELECT COUNT(*) FROM '.$GLOBALS['ecs']->table('shop_type').' WHERE cat_name = "'.$cat_name.'"');
	return $exist;
}
//获取商家分类信息
function get_shop_cat_info($cat_id)
{
	if (!$cat_id) {
		return false;
	}
	return $GLOBALS['db']->getRow('SELECT * FROM '.$GLOBALS['ecs']->table('shop_type').' WHERE cat_id = "'.$cat_id.'"');
}
?>